NotEmptyMutableList

@SinceKotoolsTypes(version = "1.3")
class NotEmptyMutableList<E>(var head: E, tail: E) : AbstractMutableList<E> , NotEmptyCollection<E>

Represents mutable lists containing at least one element.

Parameters

E

The type of elements contained in this collection.

Constructors

Link copied to clipboard
fun <E> NotEmptyMutableList(head: E, vararg tail: E)

Creates a not empty mutable list starting with a head and containing all the elements of the optional tail.

Functions

Link copied to clipboard
abstract override fun add(element: E): Boolean

open override fun add(index: Int, element: E)
fun add(index: PositiveInt, element: E)
fun add(index: StrictlyPositiveInt, element: E)

Inserts the element into this list at the specified index, or throws an IndexOutOfBoundsException if the index is out of bounds.

Link copied to clipboard
abstract override fun addAll(elements: Collection<E>): Boolean
abstract fun addAll(index: Int, elements: Collection<E>): Boolean
Link copied to clipboard
fun addOrNull(index: Int, element: E): Unit?
fun addOrNull(index: PositiveInt, element: E): Unit?
fun addOrNull(index: StrictlyPositiveInt, element: E): Unit?

Inserts the element into this list at the specified index, or returns null if the index is out of bounds.

Link copied to clipboard
abstract override fun clear()
Link copied to clipboard
abstract operator override fun contains(element: E): Boolean
Link copied to clipboard
abstract override fun containsAll(elements: Collection<E>): Boolean
Link copied to clipboard
open fun forEach(p0: Consumer<in E>)
Link copied to clipboard
open infix operator fun get(index: PositiveInt): E
open infix operator fun get(index: StrictlyPositiveInt): E

Returns the element at the specified index in this collection, or throws an IndexOutOfBoundsException if the index is out of bounds.

open infix operator override fun get(index: Int): E

Returns the element at the specified index in this collection, or throws an IndexOutOfBoundsException if the index is out of bounds.

Link copied to clipboard
open infix fun getOrNull(index: Int): E?
open infix fun getOrNull(index: PositiveInt): E?
open infix fun getOrNull(index: StrictlyPositiveInt): E?

Returns the element at the specified index in this collection, or returns null if the index is out of bounds.

Link copied to clipboard
abstract fun indexOf(element: E): Int
Link copied to clipboard
open override fun isEmpty(): Boolean
Link copied to clipboard
abstract operator override fun iterator(): Iterator<E>
Link copied to clipboard
abstract fun lastIndexOf(element: E): Int
Link copied to clipboard
abstract override fun listIterator(): MutableListIterator<E>
abstract override fun listIterator(index: Int): MutableListIterator<E>
Link copied to clipboard
open fun parallelStream(): Stream<E>
Link copied to clipboard
abstract override fun remove(element: E): Boolean
Link copied to clipboard
abstract override fun removeAll(elements: Collection<E>): Boolean
Link copied to clipboard
open infix override fun removeAt(index: Int): E
infix fun removeAt(index: PositiveInt): E
infix fun removeAt(index: StrictlyPositiveInt): E

Removes an element at the specified index from the list, or throws an IndexOutOfBoundsException if the index is out of bounds.

Link copied to clipboard
infix fun removeAtOrNull(index: Int): E?
infix fun removeAtOrNull(index: PositiveInt): E?

Removes an element at the specified index from the list, or returns null if the index is out of bounds.

Link copied to clipboard
open fun removeIf(p0: Predicate<in E>): Boolean
Link copied to clipboard
open fun replaceAll(p0: UnaryOperator<E>)
Link copied to clipboard
abstract override fun retainAll(elements: Collection<E>): Boolean
Link copied to clipboard
open operator override fun set(index: Int, element: E): E
operator fun set(index: PositiveInt, element: E): E
operator fun set(index: StrictlyPositiveInt, element: E): E

Replaces the element at the specified index in this list with the specified element, or throws an IndexOutOfBoundsException if the index is out of bounds.

Link copied to clipboard
fun setOrNull(index: Int, element: E): E?
fun setOrNull(index: PositiveInt, element: E): E?
fun setOrNull(index: StrictlyPositiveInt, element: E): E?

Replaces the element at the specified index in this list with the specified element, or returns null if the index is out of bounds.

Link copied to clipboard
open fun sort(p0: Comparator<in E>)
Link copied to clipboard
open override fun spliterator(): Spliterator<E>
Link copied to clipboard
open fun stream(): Stream<E>
Link copied to clipboard
abstract override fun subList(fromIndex: Int, toIndex: Int): MutableList<E>
Link copied to clipboard
open fun toArray(): Array<Any>
open fun <T : Any> toArray(p0: Array<T>): Array<T>
open fun <T : Any> toArray(p0: IntFunction<Array<T>>): Array<T>
Link copied to clipboard

Returns the string representation of this collection as a not blank string.

Properties

Link copied to clipboard
open override var head: E

First element of this collection.

Link copied to clipboard
open override val size: Int
Link copied to clipboard

Returns the size of this collection as a strictly positive int.

Extensions

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> NotEmptyCollection<E>.getOrElse(index: Int, defaultValue: (Int) -> @UnsafeVariance E): E
@SinceKotoolsTypes(version = "1.3")
inline fun <E> NotEmptyCollection<E>.getOrElse(index: PositiveInt, defaultValue: (PositiveInt) -> @UnsafeVariance E): E
@SinceKotoolsTypes(version = "1.3")
inline fun <E> NotEmptyCollection<E>.getOrElse(index: StrictlyPositiveInt, defaultValue: (StrictlyPositiveInt) -> @UnsafeVariance E): E

Returns the element at the specified index in this collection, or returns the result of calling the defaultValue function if the index is out of bounds.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptyList(): NotEmptyList<E>

Returns a not empty list containing all the elements of this collection, or throws an IllegalArgumentException if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
infix inline fun <E> Collection<E>.toNotEmptyListOrElse(defaultValue: (Collection<E>) -> NotEmptyList<E>): NotEmptyList<E>

Returns a not empty list containing all the elements of this collection, or returns the result of calling the defaultValue function if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptyListOrNull(): NotEmptyList<E>?

Returns a not empty list containing all the elements of this collection, or returns null if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptyMutableList(): NotEmptyMutableList<E>

Returns a not empty mutable list containing all the elements of this collection, or throws an IllegalArgumentException if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
infix inline fun <E> Collection<E>.toNotEmptyMutableListOrElse(defaultValue: (Collection<E>) -> NotEmptyMutableList<E>): NotEmptyMutableList<E>

Returns a not empty mutable list containing all the elements of this collection, or returns the result of calling the defaultValue function if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptyMutableListOrNull(): NotEmptyMutableList<E>?

Returns a not empty mutable list containing all the elements of this collection, or returns null if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptyMutableSet(): NotEmptyMutableSet<E>

Returns a not empty mutable set containing all the elements of this collection, or throws an IllegalArgumentException if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
infix inline fun <E> Collection<E>.toNotEmptyMutableSetOrElse(defaultValue: (Collection<E>) -> NotEmptyMutableSet<E>): NotEmptyMutableSet<E>

Returns a not empty mutable set containing all the elements of this collection, or returns the result of calling the defaultValue function if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptyMutableSetOrNull(): NotEmptyMutableSet<E>?

Returns a not empty mutable set containing all the elements of this collection, or returns null if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptySet(): NotEmptySet<E>

Returns a not empty set containing all the elements of this collection, or throws an IllegalArgumentException if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
infix inline fun <E> Collection<E>.toNotEmptySetOrElse(defaultValue: (Collection<E>) -> NotEmptySet<E>): NotEmptySet<E>

Returns a not empty set containing all the elements of this collection, or returns the result of calling the defaultValue function if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
inline fun <E> Collection<E>.toNotEmptySetOrNull(): NotEmptySet<E>?

Returns a not empty set containing all the elements of this collection, or returns null if this collection is empty.